{layout name="Layout/layout" /}
<link href="/bootstrap/css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
<div class="wrapper wrapper-content  animated fadeInRight hidden">
    <div class="row ">
        <div class="col-sm-12">
            <div class="ibox  ">
                <div class="ibox-title">
                    <h5>Sweet Alert</h5>
                </div>
                <div class="ibox-content">

                    <strong>可以替换JavaScript中alert的插件</strong>

                    <div class="row text-center">
                        <div class="col-sm-6 h-100 p-lg">
                            <p>基本消息</p>
                            <button class="btn btn-primary btn-sm demo1">确定</button>
                        </div>

                        <div class="col-sm-6 h-100 p-lg">
                            <p>成功提示 </p>
                            <button class="btn btn-success btn-sm demo2"
                                    redirect-url={if condition="isset($redirect_url)" }"{$redirect_url}"{else/}{/if}>确定</button>
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>

<script src="/bootstrap/js/plugins/sweetalert/sweetalert.min.js"></script>
<script>
    $(document).ready(function () {


        $('.demo2').click(function () {
            var redirect_url = $(this).attr("redirect-url");
            swal({
                title: "提示信息",
                text: "{$msg}"
               // type: "success"
            }, function () {
                if(redirect_url){
                    window.location.href=redirect_url;
                }else{
                    window.history.back(-2);
                }
            });
        });
        $('.demo2').click();
       /* function JumpUrl() {
            var url = '<?php  if(isset($redirect_url)){echo $redirect_url;}?>';
            if (url){
                window.location.href = url;
            }else{
                window.history.back(-2);
            }

        }
        setTimeout(JumpUrl, 3);*/

    });
</script>
